#pragma once
#include "list.hpp"
namespace cc
{
    template<class Iterator, class ref, class ptr>
    struct reve_iterator
    {
    public:
        typedef reve_iterator<Iterator, ref, ptr> riterator;
        reve_iterator(Iterator it)
            : It(it)
        {}
        bool operator!=(const riterator& d)const
        {
            return It != d.It;
        }
        riterator& operator++()
        {
            It--;
            return *this;
        }
        riterator operator++(int)
        {
            Iterator tem(It);
            It--;
            return riterator(tem);
        }
        riterator& operator++()const
        {
            It--;
            return *this;
        }
        riterator operator++(int)const
        {
            Iterator tem(It);
            It--;
            return riterator(tem);
        }
        ref operator*()const
        {
            Iterator tem(It);
            return *(--tem);
        }
        ptr operator->()const
        {
            return &(*It);
        }
    private:
        Iterator It;
    };
}
